let app = getApp();
Page({ 
    /**
     * 页面的初始数据
     */
    data: {        
        autoplay: true,
        typeValue: null,
        showRightToast: false,
        changeImg: false,
        show: true,        
        played: false,
        //滑动触点开始的时候
        startPoint: 0,
        currentImageIndex: 0,
        swiperH:'',//swiper高度
         nowIdx:0,//当前swiper索引
         rent:0,
         city_hidden:false,
         status:0,
      
    
 
    },
 
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
    let that=this; 
    var id = options.id;
    if(id==undefined || id==''){
        id=1;
    }
    this.getIndex(id);
    var open=wx.getStorageSync('open');   
       
      that.setData({
        platform:app.globalData.platform,      
         width:app.globalData.windowWidth,
        height:app.globalData.windowHeight,
        statusBarHeight:app.globalData.statusBarHeight,
        navHeight:app.globalData.navHeight,
        marginTop:app.globalData.navTitleTop,
        domain:app.globalData.domain,
        uploadUrl:app.globalData.uploadUrl,
        tabBarHeight:app.globalData.tabBarHeight      
      })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {
        
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        //this.getIndex();
    },
    goBack(){
        var pages = getCurrentPages();
        console.log(pages);
        wx.navigateBack();
    },
    getIndex:function(id){
        var open=wx.getStorageSync('open');
        
       // var member_id=open.member_id;
        let that=this;
        wx.request({
          url:app.globalData.domain + '/wechat/help/getIndex',
          data:{form:'index',open_id:open.id,openid:open.openid,id:id},
          success:res=>{
            console.log(res);
            var data=res.data;
            
            that.setData({
             list:data.content,
             title:data.title
              
            })
          }
        })
      }, //swiper滑动事件

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onShareTimeline(){
        //console.log(e);
        var open = wx.getStorageSync('open');
        var parent_id = open.id;
        var that = this;
        var title = this.data.shareTitle;
        var shareLogo = this.data.shareLogo;
        var store_id = wx.getStorageSync('store_id');
         console.log(shareLogo);
         console.log(title);
         return{
           title: title,                 
           query: 'parent_id='+parent_id+'&store_id'+store_id+'&share=1',        
           imageUrl:shareLogo      
           }
       },
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
        var more = this.data.more;
        var page = this.data.page;
        if(more == 1){
           // page=parseInt(page)+1;
           // this.getCity(page)
        }else{
            console.log('no more');
        } 
    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage(e) {
        var open = wx.getStorageSync('open');
        var parent_id = open.id;
        var that = this;
        var title=this.data.shareTitle;
        var shareLogo=this.data.shareLogo;
        var store_id = wx.getStorageSync('store_id');
   　　var shareObj = {
   　　　　title: title,    
   　　　　path: '/pages/index/index?parent_id='+parent_id+'&store_id='+store_id+'&share=1',
   　　　　imageUrl: shareLogo 
   　　　
   　　}
   　　// 来自页面内的按钮的转发
   　　if( e.from == 'button' ){
     　　　shareObj.title=title;
   　　　　shareObj.path = '/pages/index/index?parent_id='+parent_id+'&store_id='+store_id+'&share=1';
   　　}
   console.log(shareObj);
   　　// 返回shareObj
   　　return shareObj;
    }
})